dir (command)

In computing, dir (directory) is a command used for file and directory listing, specifically in the command line interface (CLI) of the RT-11, CP/M, VMS, DOS, OS/2, Singularity and Microsoft Windows operating systems. It is analogous to the Unix ls command.

Because it is the primary means of displaying the files and directories on disk or other storage medium within a command window, the dir command is one of the most basic commands employed by users of the command line interface to MS-DOS and various versions of Windows.[1]

The dir command has existed as a DOS command since the initial release of MS-DOS. It is built into the DOS command shell, and is not provided as a separate standalone program.

In DOS and Microsoft Windows, dir checks for switches in the %dircmd% environment variable.

In Windows PowerShell, dir is a predefined command alias for the Get-ChildItem Cmdlet which basically serves the same purpose.

Sample usage

The following example demonstrates the output of the dir command on Windows 7, given no- and one argument(s):

C:\Users\Public\Pictures\Sample Pictures>dir
 Volume in drive C is System
 Volume Serial Number is C8D0-76E2

 Directory of C:\Users\Public\Pictures\Sample Pictures

14-07-2009  06:41    <DIR>          .
14-07-2009  06:41    <DIR>          ..
14-07-2009  06:52           879,394 Chrysanthemum.jpg
14-07-2009  06:52           845,941 Desert.jpg
14-07-2009  06:52           595,284 Hydrangeas.jpg
14-07-2009  06:52           775,702 Jellyfish.jpg
14-07-2009  06:52           780,831 Koala.jpg
14-07-2009  06:52           561,276 Lighthouse.jpg
14-07-2009  06:52           777,835 Penguins.jpg
14-07-2009  06:52           620,888 Tulips.jpg
               8 File(s)      5,837,151 bytes
               2 Dir(s)  57,925,980,160 bytes free

C:\Users\Public\Pictures\Sample Pictures>dir /w
 Volume in drive C is System
 Volume Serial Number is C8D0-76E2

 Directory of C:\Users\Public\Pictures\Sample Pictures

[.]                 [..]                Chrysanthemum.jpg   Desert.jpg          Hydrangeas.jpg      Jellyfish.jpg
Koala.jpg           Lighthouse.jpg      Penguins.jpg        Tulips.jpg
               8 File(s)      5,837,151 bytes
               2 Dir(s)  57,925,992,448 bytes free

C:\Users\Public\Pictures\Sample Pictures>

See also

References